const http = require('http');

const querystring = require('querystring');

http.createServer((req,res)=>{
    var GET = {};
    //通过req 获取前台的请求数据
    console.log(req.url);//  /?username=111&password=222

    if(req.url.indexOf('?')!=-1){
        var arr = req.url.split('?');
        var url = arr[0];
        GET = querystring.parse(arr[1]);
    }else{
        var url = req.url;
    }
    console.log(url,GET);
}).listen(8080);
